<template>
  <div class="big-box">
    <div class="wrapper">
      <img src="../../public/imgs/how.png" alt="" class="image" />
      <ul>
        <li>成功推荐一本书到书单后,将获得书单提案权限;</li>
        <li>鱼编审核通过你的书单提案,即成为客座鱼编。</li>
      </ul>
    </div>
    <div class="content" v-for="item in newbooks" :key="item.id">
      <div>
        <div class="container">
          <router-link :to="'/NewBooksList/' + item.id">
            <div class="header">
              <span>
                <img :src="item.url" />
              </span>
              <div class="header-text">{{ item.title }}</div>
            </div>
            <div class="wrapper-two">
              <div class="content1">
                <div class="title">{{ item.text }}</div>
                <div class="description">{{ item.sentence }}</div>
              </div>
              <button class="Button-small">
                <div>推荐</div>
              </button>
            </div>
          </router-link>
        </div>
      </div>
    </div>

    <Home />
    <Back1/>
  </div>
</template>

<script>
import Home from "../pages/Home.vue";
import Back1 from "./Back1.vue";
import axios from "axios";
export default {
  name: "NewBooks",
  components: {
    Home,
    Back1
  },
  data() {
    return {
      newbooks: [],
    };
  },
  created() {
    axios({
      url: "http://localhost:3000/newbooks",
      method: "get",
      params: {},
    }).then((res) => {
      this.newbooks = res.data;
    });
  },
};
</script>

<style scoped>
.big-box {
  margin-top: 48px;
  box-sizing: border-box;
  min-height: 100vh;
  padding-bottom: 51px;
}
.wrapper {
  display: flex;
  flex-direction: column;
  padding: 15px;
  background-color: rgb(243, 252, 251);
}
.image {
  object-fit: contain;
  width: 50%;
}
.wrapper ul {
  color: rgb(170, 170, 170);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.wrapper ul li {
  padding-left: 16px;
  position: relative;
  margin-bottom: 0px;
}
.wrapper ul li::before {
  content: "";
  box-sizing: border-box;
  width: 4px;
  height: 4px;
  position: absolute;
  left: 0px;
  top: 7.75px;
  border-radius: 50%;
  background: rgb(73, 119, 73);
  border: 1px solid rgb(73, 119, 73);
}
.content {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
}
.container {
  border-bottom: 0.01rem solid rgb(242, 242, 242);
  background: rgb(255, 255, 255);
}
.header {
  display: flex;
  align-items: center;
  padding: 0.15rem 0.15rem 0rem;
}
.wrapper-two {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  justify-content: space-between;
  padding: 0.1rem 0.15rem 0.15rem;
}
.header span {
  flex-shrink: 0;
  width: 0.18rem;
  height: 0.18rem;
  display: inline-block;
  vertical-align: top;
  box-sizing: border-box;
  background: rgb(242, 242, 242);
  border: 0.01rem solid rgb(242, 242, 242);
  border-radius: 0.99rem;
  overflow: hidden;
}
.header span img {
  display: block;
  width: 100%;
}
.header .header-text {
  overflow: hidden;
  margin-left: 0.06rem;
  color: rgb(170, 170, 170);
  font-size: 0.13rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.content1 {
  display: flex;
  flex-direction: column;
  -webkit-box-pack: center;
  justify-content: center;
  min-width: 0rem;
}
.title {
  color: rgb(51, 51, 51);
  font-size: 0.16rem;
  font-weight: 500;
}
.description {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 0.02rem;
  color: rgb(170, 170, 170);
  font-size: 0.13rem;
  font-weight: 400;
  line-height: 0.18rem;
  max-height: 0.36rem;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.Button-small {
  color: rgb(24, 195, 170);
  background: rgba(230, 230, 230, 0.4);
  border: none;
  margin-left: 0.15rem;
  width: 0.7rem;
  height: 0.32rem;
  font-weight: 500;
  font-size: 0.14rem;
  padding: 0.06rem 0.16rem;
  margin-left: 0.15rem;
  border-radius: 9.99rem;
  pointer-events: auto;
  cursor: pointer;
  box-sizing: border-box;
}
.Button-small div {
  width: 0.4rem;
  height: 0.32rem;
  text-align: center;
}
</style>